package com.chuangke.flow.constant;

import com.chuangke.flow.enums.FlowNodeStatusEnum;

import java.util.HashMap;
import java.util.Map;

public class FlowConstant {

	/**流程启动参数标准字段*/
	public static final String VAR_STANDARD_COL_ORDER_ID = "orderId";// 单据ID
	public static final String VAR_STANDARD_COL_ORDER_TYPE = "orderType";// 单据类型
	public static final String VAR_STANDARD_COL_ORDER_DEPT_ID = "orderDeptId";// 组织机构
	public static final String VAR_STANDARD_COL_ORDER_DATE = "orderDate";// 业务日期
	public static final String VAR_STANDARD_COL_ORDER_PROJECT_ID = "orderProjectId";// 项目
	public static final String VAR_STANDARD_COL_ORDER_AMOUNT = "orderAmount";// 金额
	public static final String VAR_STANDARD_COL_ORDER_REMARKS = "orderRemarks";// 备注
	public static final String VAR_STANDARD_COL_ORDER_CREATED_BY = "orderCreatedBy";// 发起人
	public static final String VAR_STANDARD_COL_ORDER_CREATED_AT = "orderCreatedAt";// 发起时间
	public static final String VAR_STANDARD_COL_ORDER_SERVICE = "orderService";//流程服务

	//默认流程查找用户服务
	public static final String DEFAULT_FLOW_GET_TASK_USER_SERVICE = "defaultFlowGetTaskUser";

	public static final String VAR_NAME_DEPT = "deptId";
	public static final String VAR_NAME_AUDIT_OPT = "audit";
	public static final String VAR_NAME_FORM = "formModel";

	public static final String EDIT_USER_TASK_ID = "editTask";

	public static final String HANDLE_ORDER_COMPLETE = "complete";
	public static final String HANDLE_ORDER_COMPLETE_BATCH = "completeBatch";
	public static final String HANDLE_ORDER_SUBMIT = "submit";
	public static final String HANDLE_ORDER_SUBMIT_BATCH = "submitBatch";
	public static final String HANDLE_ORDER_REJECT = "reject";
	public static final String HANDLE_ORDER_REJECT_BATCH = "rejectBatch";
	public static final String HANDLE_ORDER_CANCEL_SUBMIT = "cancelSubmit";
	public static final String HANDLE_ORDER_CANCEL_SUBMIT_BATCH = "cancelSubmitBatch";

	//流程类型
	public static final String FLOW_TYPE_NORMAL = "n" ;//flow
	public static final String FLOW_TYPE_LOGIC= "g" ;//logic_flow
	
	public static final String VAR_AUDIT_OPT_AGREE = "agree";// 同意
	public static final String VAR_AUDIT_OPT_REJECT = "reject";// 退回
	public static final String VAR_AUDIT_OPT_REVOKE = "revoke";// 撤回
	
	/** 节点类型 */
	public static final String NODE_TYPE_START = "start";// 发起人
	public static final String NODE_TYPE_APPROVER = "approver";// 审批人
	public static final String NODE_TYPE_COPY = "copy";// 抄送人
	public static final String NODE_TYPE_CONDITION = "condition";// 条件分支

	/**节点类型（logic_flow）*/
	public static final String LOGIC_NODE_TYPE_START = "CustomStart";//开始节点
	public static final String LOGIC_NODE_TYPE_USERTASK = "UserTask";//审批节点
	public static final String LOGIC_NODE_TYPE_CONDITION = "CustomCondition";// 条件分支
	public static final String LOGIC_NODE_TYPE_LINE = "bpmn:sequenceFlow";//流程连线
	public static final String LOGIC_NODE_TYPE_END = "CustomEnd";//结束节点
	public static final String LOGIC_NODE_TYPE_SUBFLOW = "ChildrenFlow";//子流程节点Subflow

	// user:指定人员;role:角色;optional:发起人自选;myself:发起人自己
	public static final String ASSIGNEE_TYPE_USER = "user";
	public static final String ASSIGNEE_TYPE_ROLE = "role";
	public static final String ASSIGNEE_TYPE_OPTIONAL = "optional";
	public static final String ASSIGNEE_TYPE_MYSELF = "myself";

	//"多人审批时采用的审批方式
	//1:会签(须所有审批人同意);2:或签(一名审批人同意或拒绝即可)"
	public static final String COUNTER_SIGN_HUIQ = "1" ;
	public static final String COUNTER_SIGN_HUOQ = "2" ;

	public static final String ORDER_NO = "FLOW";
	//单据流程审批状态
	public static final String STATUS_BZZ="1";
	public static final String STATUS_SPZ="5";
	public static final String STATUS_YWC="9";


	public static final String TASK_TYPE_APPROVAL = "approval";//审批：无其他协作方式
	public static final String TASK_TYPE_TRANSFER = "transfer";//转办：任务转给其他人办理
	public static final String TASK_TYPE_DEPUTE = "depute";//委派：求助其他人审批，然后参照他的意见决定是否审批通过
	public static final String TASK_TYPE_ADD_BEFORE = "add_before";//前加签：将任务委派给其他人，其他人处理后再处理
	public static final String TASK_TYPE_ADD_AFTER = "add_after";//后加签：审批完成后转给其他人处理

	public static final Map<String, String> OPT_STATE_MAP = new HashMap<>();

	static {
		OPT_STATE_MAP.put(VAR_AUDIT_OPT_AGREE, FlowNodeStatusEnum.agree.getCode());
		OPT_STATE_MAP.put(VAR_AUDIT_OPT_REJECT, FlowNodeStatusEnum.reject.getCode());
		OPT_STATE_MAP.put(VAR_AUDIT_OPT_REVOKE, FlowNodeStatusEnum.revoke.getCode());
	}

}
